package com.yunhe.energy.client;

import com.yunhe.energy.client.fallback.MeasRealtimeFallbackFactory;
import com.yunhe.common.model.ResultObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 实时数据Feign客户端
 * @author liuronglei
 */
@FeignClient(value = "meas-realtime", fallbackFactory = MeasRealtimeFallbackFactory.class)
@RequestMapping("/measurements/realtime")
public interface MeasRealtimeClient {

    /**
     * 根据点号获得量测实时值
     * @param pointNumber 点号
     */
    @RequestMapping(method = RequestMethod.GET)
    ResponseEntity<ResultObject<Map<Long, Double>>> getMeasureRealtime(@RequestParam("pointNumber") List<Long> pointNumber);

    /**
     * 设置量测实时值
     * @param pointNumber 点号
     * @param value 量测值
     */
    @RequestMapping(method = RequestMethod.POST)
    ResponseEntity<ResultObject> setMeasureRealtime(@RequestParam("pointNumber") Long pointNumber,
                                                    @RequestParam("value") Double value);
}
